VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TabCtl32.Ocx"
Begin VB.Form frmOptionEmail 
   Caption         =   "E-Mail Account"
   ClientHeight    =   6690
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6855
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6690
   ScaleWidth      =   6855
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.ListBox lstStatus 
      BackColor       =   &H80000000&
      Height          =   1035
      Left            =   960
      TabIndex        =   13
      Top             =   6720
      Width           =   5775
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   6375
      Left            =   120
      TabIndex        =   14
      Top             =   240
      Width           =   6615
      _ExtentX        =   11668
      _ExtentY        =   11245
      _Version        =   393216
      Tabs            =   2
      TabHeight       =   520
      TabCaption(0)   =   "General"
      TabPicture(0)   =   "Option.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Label7"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Label1"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Label2"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "Label3"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "Label4"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "Label5"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).Control(6)=   "txtPort"
      Tab(0).Control(6).Enabled=   0   'False
      Tab(0).Control(7)=   "Frame1"
      Tab(0).Control(7).Enabled=   0   'False
      Tab(0).Control(8)=   "txtSMTP"
      Tab(0).Control(8).Enabled=   0   'False
      Tab(0).Control(9)=   "txtYourName"
      Tab(0).Control(9).Enabled=   0   'False
      Tab(0).Control(10)=   "txtEMail"
      Tab(0).Control(10).Enabled=   0   'False
      Tab(0).Control(11)=   "cmdTestAccount"
      Tab(0).Control(11).Enabled=   0   'False
      Tab(0).Control(12)=   "cmdOk"
      Tab(0).Control(12).Enabled=   0   'False
      Tab(0).ControlCount=   13
      TabCaption(1)   =   "Compose"
      TabPicture(1)   =   "Option.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Label9"
      Tab(1).Control(1)=   "Label10"
      Tab(1).Control(2)=   "cmdReset"
      Tab(1).Control(3)=   "txtSubject"
      Tab(1).Control(4)=   "txtMessage"
      Tab(1).Control(5)=   "cmdOKCompose"
      Tab(1).ControlCount=   6
      Begin VB.CommandButton cmdOKCompose 
         Caption         =   "&Ok"
         Height          =   375
         Left            =   -70440
         TabIndex        =   11
         Top             =   5760
         Width           =   1215
      End
      Begin VB.TextBox txtMessage 
         Height          =   4335
         Left            =   -73920
         MultiLine       =   -1  'True
         TabIndex        =   10
         Text            =   "Option.frx":0038
         Top             =   1200
         Width           =   5295
      End
      Begin VB.TextBox txtSubject 
         Height          =   375
         Left            =   -73920
         TabIndex        =   9
         Text            =   "Subject"
         Top             =   720
         Width           =   5295
      End
      Begin VB.CommandButton cmdOk 
         Caption         =   "&Ok"
         Height          =   375
         Left            =   4560
         TabIndex        =   8
         Top             =   5760
         Width           =   1215
      End
      Begin VB.CommandButton cmdTestAccount 
         Caption         =   "&Test Account Settings ..."
         Height          =   375
         Left            =   600
         TabIndex        =   7
         Top             =   5760
         Visible         =   0   'False
         Width           =   2535
      End
      Begin VB.TextBox txtEMail 
         Height          =   375
         Left            =   2400
         TabIndex        =   3
         Text            =   "Your email"
         Top             =   2880
         Width           =   3975
      End
      Begin VB.TextBox txtYourName 
         Height          =   375
         Left            =   2400
         TabIndex        =   2
         Text            =   "Your name"
         Top             =   2400
         Width           =   3975
      End
      Begin VB.TextBox txtSMTP 
         Height          =   375
         Left            =   2400
         TabIndex        =   0
         Text            =   "mail.eastseatravel.com"
         Top             =   960
         Width           =   3975
      End
      Begin VB.CommandButton cmdReset 
         Caption         =   "&Reset"
         Height          =   375
         Left            =   -73560
         TabIndex        =   12
         Top             =   5760
         Width           =   1215
      End
      Begin VB.Frame Frame1 
         Caption         =   "Outgoing server"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2175
         Left            =   240
         TabIndex        =   17
         Top             =   3360
         Width           =   6135
         Begin VB.TextBox txtUserName 
            Enabled         =   0   'False
            Height          =   405
            Left            =   2160
            TabIndex        =   5
            Text            =   "ID"
            Top             =   840
            Width           =   3615
         End
         Begin VB.TextBox txtPassword 
            Enabled         =   0   'False
            Height          =   375
            IMEMode         =   3  'DISABLE
            Left            =   2160
            PasswordChar    =   "*"
            TabIndex        =   6
            Text            =   "Pass"
            Top             =   1440
            Width           =   3615
         End
         Begin VB.CheckBox ckSMTPLogin 
            Caption         =   "My Outgoing server (SMTP) requires authentication"
            Enabled         =   0   'False
            Height          =   375
            Left            =   240
            TabIndex        =   4
            Top             =   360
            Width           =   4455
         End
         Begin VB.Label Label6 
            Caption         =   "&User Name"
            Height          =   375
            Left            =   1200
            TabIndex        =   19
            Top             =   840
            Width           =   975
         End
         Begin VB.Label Label13 
            Caption         =   "&Password"
            Height          =   375
            Left            =   1200
            TabIndex        =   18
            Top             =   1440
            Width           =   975
         End
      End
      Begin VB.TextBox txtPort 
         Height          =   375
         Left            =   2400
         TabIndex        =   1
         Text            =   "25"
         Top             =   1560
         Width           =   3975
      End
      Begin VB.Label Label10 
         Caption         =   "&Message:"
         Height          =   375
         Left            =   -74760
         TabIndex        =   27
         Top             =   1200
         Width           =   735
      End
      Begin VB.Label Label9 
         Caption         =   "&Subject:"
         Height          =   495
         Left            =   -74760
         TabIndex        =   26
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label5 
         Caption         =   "Server Information"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   360
         TabIndex        =   25
         Top             =   600
         Width           =   1815
      End
      Begin VB.Label Label4 
         Caption         =   "User Information"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   360
         TabIndex        =   24
         Top             =   2040
         Width           =   1695
      End
      Begin VB.Label Label3 
         Caption         =   "&E-Mail Address:"
         Height          =   375
         Left            =   600
         TabIndex        =   23
         Top             =   2880
         Width           =   1575
      End
      Begin VB.Label Label2 
         Caption         =   "&Your Name:"
         Height          =   375
         Left            =   600
         TabIndex        =   22
         Top             =   2400
         Width           =   1815
      End
      Begin VB.Label Label1 
         Caption         =   "Outgoing mail (&SMTP):"
         Height          =   375
         Left            =   600
         TabIndex        =   21
         Top             =   960
         Width           =   1695
      End
      Begin VB.Label Label7 
         Caption         =   "Outgoing  port numbers:"
         Height          =   375
         Left            =   600
         TabIndex        =   20
         Top             =   1560
         Width           =   1695
      End
   End
   Begin VB.Label lblProgress 
      Caption         =   "Progress"
      Height          =   255
      Left            =   2520
      TabIndex        =   16
      Top             =   7800
      Width           =   1695
   End
   Begin VB.Label Label11 
      Caption         =   "Status"
      Height          =   615
      Left            =   120
      TabIndex        =   15
      Top             =   6720
      Width           =   735
   End
End
Attribute VB_Name = "frmOptionEmail"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' *****************************************************************************
' Required declaration of the vbSendMail component (withevents is optional)
' You also need a reference to the vbSendMail component in the Project References
' *****************************************************************************
'Private WithEvents poSendMail As vbSendMail.clsSendMail
'Private WithEvents poSendMail As clsSendMail
' misc local vars

Private Sub ckSMTPLogin_Click()
    If ckSMTPLogin.Value = vbChecked Then
        txtUserName.Enabled = True
        txtPassword.Enabled = True
        bAuthLogin = True
    Else
        txtUserName = ""
        txtPassword = ""
        txtUserName.Enabled = False
        txtPassword.Enabled = False
        bAuthLogin = False
        'If ckLogin.Value = vbUnchecked Then fraOptions.Height = 2475
    End If
End Sub

Private Sub cmdOK_Click()
    Writetext
    Unload Me
'    Dim frm As Form
    
'    For Each frm In Forms
'        Unload frm
'        Set frm = Nothing
'    Next
    
    'End

End Sub

Private Sub cmdOKCompose_Click()
    cmdOK_Click
End Sub

Private Sub Writetext()
    esmtp = txtSMTP.Text
    eport = txtPort
    eyourname = txtYourName
    email = txtEMail
    
    If ckSMTPLogin.Value = vbChecked Then
        bAuthLogin = "TRUE"
    Else
        bAuthLogin = "FALSE"
    End If
    eusername = txtUserName
    epassword = txtPassword
    esubject = txtSubject
    emessage = txtMessage
    WriteTextFile (App.Path & "\mailer.ini")
End Sub

Private Sub Readtext()
    ReadTextFile (App.Path & "\mailer.ini")
    txtSMTP = esmtp
    txtPort = eport
    txtYourName = eyourname
    txtEMail = email
    If bAuthLogin = "TRUE" Then
        ckSMTPLogin.Value = vbChecked
    Else
        ckSMTPLogin.Value = vbUnchecked
    End If
    txtUserName = eusername
    txtPassword = epassword
    txtSubject = esubject
    txtMessage = emessage
End Sub

Private Sub Command1_Click()
    Writetext
End Sub

Private Sub cmdReset_Click()
    'ClearTextBoxesOnForm
    lstStatus.Clear
    txtSubject = ""
    txtMessage = ""
    lblProgress = ""
    '''''''''''''RetrieveSavedValues
End Sub

''''''''Private Sub cmdTestAccount_Click()
''''''''    Me.Height = 8490
''''''''    ' *****************************************************************************
''''''''    ' This is where all of the Components Properties are set / Methods called
''''''''    ' *****************************************************************************
''''''''
''''''''    cmdTestAccount.Enabled = False
''''''''    lstStatus.Clear
''''''''    Screen.MousePointer = vbHourglass
''''''''
''''''''    With poSendMail
''''''''
''''''''        ' **************************************************************************
''''''''        ' Optional properties for sending email, but these should be set first
''''''''        ' if you are going to use them
''''''''        ' **************************************************************************
''''''''
''''''''        .SMTPHostValidation = VALIDATE_NONE         ' Optional, default = VALIDATE_HOST_DNS
''''''''        .EmailAddressValidation = VALIDATE_SYNTAX   ' Optional, default = VALIDATE_SYNTAX
''''''''        .Delimiter = ";"                            ' Optional, default = ";" (semicolon)
''''''''
''''''''        ' **************************************************************************
''''''''        ' Basic properties for sending email
''''''''        ' **************************************************************************
''''''''        .SMTPHost = txtSMTP.Text                  ' Required the fist time, optional thereafter
''''''''        .from = txtEMail.Text                        ' Required the fist time, optional thereafter
''''''''        .FromDisplayName = txtYourName.Text         ' Optional, saved after first use
''''''''        .Recipient = "lednghia@yahoo.com" 'txtEMail.Text 'txtTo.Text                     ' Required, separate multiple entries with delimiter character
''''''''        .RecipientDisplayName = txtYourName.Text 'txtToName.Text      ' Optional, separate multiple entries with delimiter character
''''''''
''''''''''''''        .CcRecipient = txtCc                        ' Optional, separate multiple entries with delimiter character
''''''''''''''        .CcDisplayName = txtCcName                  ' Optional, separate multiple entries with delimiter character
''''''''''''''        .BccRecipient = txtBcc                      ' Optional, separate multiple entries with delimiter character
''''''''''''''        .ReplyToAddress = txtFrom.Text              ' Optional, used when different than 'From' address
''''''''        .Subject = txtSubject.Text                  ' Optional
''''''''        .Message = txtMessage.Text                      ' Optional
''''''''''''''        .Attachment = Trim(txtAttach.Text)          ' Optional, separate multiple entries with delimiter character
''''''''
''''''''        ' **************************************************************************
''''''''        ' Additional Optional properties, use as required by your application / environment
''''''''        ' **************************************************************************
'''''''''''''''        .AsHTML = bHtml                             ' Optional, default = FALSE, send mail as html or plain text
'''''''''''''''        .ContentBase = ""                           ' Optional, default = Null String, reference base for embedded links
'''''''''''''''        .EncodeType = MyEncodeType                  ' Optional, default = MIME_ENCODE
'''''''''''''''        .Priority = etPriority                      ' Optional, default = PRIORITY_NORMAL
'''''''''''''''        .Receipt = bReceipt                         ' Optional, default = FALSE
''''''''        .UseAuthentication = bAuthLogin             ' Optional, default = FALSE
'''''''''''''''        .UsePopAuthentication = bPopLogin           ' Optional, default = FALSE
''''''''        .UserName = txtUserName                     ' Optional, default = Null String
''''''''        .Password = txtPassword                     ' Optional, default = Null String, value is NOT saved
'''''''''''''''        .POP3Host = txtPopServer
'''''''''''''''        .MaxRecipients = 100                        ' Optional, default = 100, recipient count before error is raised
'''''''''''''''
''''''''        ' **************************************************************************
''''''''        ' Advanced Properties, change only if you have a good reason to do so.
''''''''        ' **************************************************************************
''''''''        ' .ConnectTimeout = 10                      ' Optional, default = 10
''''''''        ' .ConnectRetry = 5                         ' Optional, default = 5
''''''''        ' .MessageTimeout = 60                      ' Optional, default = 60
''''''''        ' .PersistentSettings = True                ' Optional, default = TRUE
''''''''        .SMTPPort = txtPort                            ' Optional, default = 25
''''''''
''''''''        ' **************************************************************************
''''''''        ' OK, all of the properties are set, send the email...
''''''''        ' **************************************************************************
''''''''        ' .Connect                                  ' Optional, use when sending bulk mail
''''''''        .Send                                       ' Required
''''''''        ' .Disconnect                               ' Optional, use when sending bulk mail
''''''''        txtSMTP.Text = .SMTPHost                  ' Optional, re-populate the Host in case
''''''''                                                    ' MX look up was used to find a host    End With
''''''''    End With
''''''''    Screen.MousePointer = vbDefault
''''''''    cmdTestAccount.Enabled = True
''''''''
''''''''End Sub

Private Sub Form_Load()
    ' *****************************************************************************
    ' Required to activate the vbSendMail component.
    ' *****************************************************************************
    
    'Set poSendMail = New clsSendMail
    Me.Height = 7095
    Readtext
End Sub

Private Sub Form_Unload(Cancel As Integer)
    ' *****************************************************************************
    ' Unload the component before quiting.
    ' *****************************************************************************

    'Set poSendMail = Nothing
End Sub

'''''Private Sub poSendMail_Progress(lPercentCompete As Long)
'''''
'''''    ' vbSendMail 'Progress Event'
'''''    lblProgress = lPercentCompete & "% complete"
'''''
'''''End Sub
'''''
'''''Private Sub poSendMail_SendFailed(Explanation As String)
'''''
'''''    ' vbSendMail 'SendFailed Event
'''''    MsgBox ("Your attempt to send mail failed for the following reason(s): " & vbCrLf & Explanation)
'''''    lblProgress = ""
'''''    Screen.MousePointer = vbDefault
'''''    cmdTestAccount.Enabled = True
'''''
'''''End Sub

'''''Private Sub poSendMail_SendSuccesful()
'''''
'''''    ' vbSendMail 'SendSuccesful Event'
'''''    MsgBox "Send Successful!"
'''''    lblProgress = ""
'''''    Me.Height = 7095
'''''
'''''End Sub
'''''
'''''Private Sub poSendMail_Status(Status As String)
'''''
'''''    ' vbSendMail 'Status Event'
'''''    lstStatus.AddItem Status
'''''    lstStatus.ListIndex = lstStatus.ListCount - 1
'''''    lstStatus.ListIndex = -1
'''''
'''''End Sub

Public Sub ClearTextBoxesOnForm()

    ' Snippet Taken From http://www.freevbcode.com

    Dim ctl As Control
    For Each ctl In Me.Controls
        If TypeOf ctl Is TextBox Then
            ctl.Text = ""
        End If
    Next

End Sub

''''''Private Sub RetrieveSavedValues()
''''''
''''''    ' *****************************************************************************
''''''    ' Retrieve saved values by reading the components 'Persistent' properties
''''''    ' *****************************************************************************
''''''    poSendMail.PersistentSettings = True
''''''    txtSMTP.Text = poSendMail.SMTPHost
''''''    txtEMail.Text = poSendMail.from
''''''    txtYourName.Text = poSendMail.FromDisplayName
''''''    txtUserName = poSendMail.UserName
''''''    'optEncodeType(poSendMail.EncodeType).Value = True
''''''    'If poSendMail.UseAuthentication Then ckLogin = vbChecked Else ckLogin = vbUnchecked
''''''
''''''End Sub


Private Sub txtPort_KeyPress(KeyAscii As Integer)
    If Not IsNumeric(Chr(KeyAscii)) Then
        KeyAscii = 0
        MsgBox "Unacceptable Character, You can only type a number here!", vbInformation, "Error"
    End If
End Sub
